<?php

namespace App\Models\Company\Task;

use App\Models\Company\Furniture\Category;
use App\Models\System\Region;
use Illuminate\Database\Eloquent\Model;

class Furniture extends Model
{
    protected $table = 'company_furniture_task';

    protected $fillable = [
        'region_id',
        'path',
        'count',
        'limit_sum',
        'time',
        'released',
        'category_id',
        'label_id',
        'is_top'
    ];

    protected $casts = [
        'is_top' => 'boolean'
    ];

    public function region()
    {
        return $this->hasOne(Region::class, 'id', 'region_id');
    }

    public function furniture()
    {
        return $this->hasMany(\App\Models\Company\Furniture::class, 'task_id', 'id');
    }

    public function category()
    {
        return $this->hasOne(Category::class, 'id', 'category_id');
    }
}
